home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
147
< prev
next >
Wrap
Text File
|
1996-08-06
|
2KB
|
40 lines
Path: gabi-soft.fr!usenet
From: kanze@gabi.gabi-soft.fr (J. Kanze)
Newsgroups: comp.std.c
Subject: Re: atexit() and return from main()
Date: 19 Jan 1996 11:49:45 GMT
Organization: GABI Software, Sarl.
Message-ID: <KANZE.96Jan19124945@gabi.gabi-soft.fr>
References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk>
<821923074snz@genesis.demon.co.uk> <4dkvjk$6q5@lyra.csx.cam.ac.uk>
NNTP-Posting-Host: gabi.gabi-soft.fr
In-reply-to: nmm1@cus.cam.ac.uk's message of 18 Jan 1996 08:15:48 GMT
In article <4dkvjk$6q5@lyra.csx.cam.ac.uk> nmm1@cus.cam.ac.uk (Nick
Maclaren) writes:
[...]
> However, for the advanced paper, think about the following problems:
>
> What is the effect of an atexit() function calling exit()? Does it
> restart the atexit() queue, carry on as if the function had returned
> or does it abandon the atexit() queue?
>
> I chose to do the second, as by far the most user-friendly, but I
> would NEVER write serious code that relied upon that action!
>
> main() calls setjmp() and then calls exit(). An atexit() function
> calls longjmp() and returns to main(). This repeats (or does it?)
>
> This is ALSO permitted by omission, but a good run-time system will
> trap it, issue an error message and stop without calling more atexit()
> functions.
According to ISO 9899: "If more than one call to the exit function is
executed by a program, the behavior is undefined."
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
-- A la recherche d'une activitΘ dans une region francophone